3.2 Buttons with indication

The indbutton class inherits the button class and the LED class. It is simply a button with a LED indicator. It is useful when the button is used as a toggle or a switch and it is necessary to indicate the state of the system to which the button is attached. It also can be used as a check box in dialogue panels.

Constructor:

indbutton(
char *title, char ascii0, char ascii1,
void (far *proc)(void),
int indradius=4, // radius of indicator
int textfont=0,int textsize=1,// font style and size of text
LEDcolors indcol=redLED, //colors of LED
buttoncolors buttextcnfg=buttextdflt,//colors of textl
plaquecolors butcol=butcoldflt); //colors of button

The new here (in comparison with the button) is that you can change the radius or color of the LED indicator overriding the default parameters. By default the indicator is red. In essence the indbutton is the sum of button and LED classes and doesn't add any new data members or methods except the Paint() method which is virtual method specific for each class.

Data members:

int on;

Status of LED. Is 0 if LED is off and 1 if LED is lighted up. Inherited from the LED class.

Methods:

There are three methods inherited from the LED class:

void On(void);
void Off(void);
Switches indicator on or off.
void Invert(void);
Changes the state of the indicator to the opposite.